<!DOCTYPE html>
<html class="iframe-h">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>后台登录</title>
    <link rel="stylesheet" type="text/css" href="__ROOT__/admin/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="__ROOT__/admin/css/admin.css" />
    <link rel="stylesheet" href="__ROOT__/static/assets/css/page.css"/>
</head>

<body>
<div id="news">
    <div class="wrap-container clearfix">
        <div class="column-content-detail">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <div class="layui-inline tool-btn">
                        <a class="layui-btn layui-btn-small layui-btn-normal " href="add.html"><i class="layui-icon">&#xe654;</i></a>
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="search" placeholder="请输入名称" autocomplete="off" class="layui-input">
                    </div>
                    <button class="layui-btn layui-btn-normal layui-inline" lay-submit="search">搜索</button>

                    <div class="layui-inline">

                    </div>
                </div>
            </form>
            <div class="layui-form" id="table-list">
                <table class="layui-table" lay-even lay-skin="nob">
                    <colgroup>
                        <col class="hidden-xs" >
                        <col class="hidden-xs">
                        <col class="hidden-xs">
                        <col>
                        <col>
                        <col>
                        <col>
                        <col>
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th class="hidden-xs">ID</th>
                        <th class="hidden-xs">楼盘名称</th>
                        <th class="hidden-xs">图片</th>
                        <th>上传时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {empty name="name"}
                    <tr>
                        <td colspan="10" align="center"> 暂无数据... </td>
                    </tr>
                    {else /}
                    {volist name="list" id="vo" key="k"}
                    <tr>
                        <td class="hidden-xs">{$k}</td>
                        <td class="hidden-xs">{$vo.title}</td>
                        <td><img src="__ROOT__{$vo.pic|substr=1}" style="width: 30px;height: 30px"></td>
                        <td class="hidden-xs">{$vo.uptime}</td>

                        <td>
                            <a class="layui-btn layui-btn-mini  " href="{:url('lou/lun')}?id={$vo.id}" data-status="1">楼盘轮播图</a>
                            <a class="layui-btn layui-btn-mini layui-btn-warm " href="{:url('lou/hu')}?id={$vo.id}" data-status="1">户型图</a>
                            <a class="layui-btn layui-btn-mini layui-btn-normal " href="{:url('lou/edit')}?id={$vo.id}" data-status="1">修改</a>
                            <a href="#" id="del"  attr-id="{$vo.id}"class="layui-btn layui-btn-mini layui-btn-danger table-list-status" data-status="2">删除</a>
                        </td>
                    </tr>
                    {/volist}
                    {/empty}

                    </tbody>
                </table>
                <div class="pages" style="float: left">{$page}</div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="__ROOT__/static/assets/js/jquery-2.1.4.min.js"></script>
<script src="__ROOT__/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="__ROOT__/admin/js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="__ROOT__/static/assets/js/dialog/layer.js"></script>
<script src="__ROOT__/static/assets/js/dialog.js"></script>
<script>
    // 删除按钮
    $(" #del").click(function () {

        var id = $(this).attr('attr-id');
        var url ="{:url('lou/del')}" ;
        data = {};
        data['id']=id;

        layer.open({
            type :0,
            title:'确认删除?',
            btn:['是','否'],
            icon:3,
            closeBtn:2,
            content:"是否确定删除",
            scrollbar:true,
            yes:function () {
                //执行跳转
                todelete(url,data);
            }
        });

    });

    function todelete(url,data) {
        $.post(
            url,
            data,
            function (s) {
                if(s.status ==1){
                    return dialog.success(s.message,'');
                }else{
                    return dialog.error(s.message);
                }
            }
            ,'JSON');

    }
</script>
<script type="text/javascript">
    function news(id){    //news函数名 一定要和action中的第三个参数一致上面有
        var id = id;
        $.get('{:url("lou/index")}', {'p':id}, function(data){  //IndexAction中的用get方法发送信息到news方法,注意此处的链接
            $("#news").replaceWith("<div  id='news'>"+data+"</div>"); //news一定要和tpl中的一致
        });
    }

</script>
</body>

</html>